<!DOCTYPE html>
<html lang="en" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/css/custom.form.css">
    <style>
        .layui-table-box{
            overflow: visible;
        }
        .layui-table-box{
            overflow: visible;
        }
        .layui-table-header{
            overflow: visible;
        }
        .layui-table-box{
            overflow: visible;
        }
        .layui-table-main{
            overflow: visible;
        }
    </style>
</head>
<body>
<div class="cqyj_table_div">
    <form class="layui-form" method="post">
        <div class="layui-form-item">

            <div class="layui-input-inline">
                <input type="text" readonly class="layui-input" id="lasjTime" placeholder="立案时间">
            </div>

            <div class="layui-input-inline" >
<!--                <button class="layui-btn" onclick="search()" id="search">查询</button>-->
                <button type="button" class="layui-btn" lay-submit="" lay-filter="demo">查询</button>
            </div>


    </div>
    <table class="layui-hide" id="ajcx_table" lay-filter="ajcx_table"></table>
    </form>
</div>
</body>
<script src="/layui/layui.all.js"></script>
<script src="/layui-ext/selectM/selectM.js"></script>
<script src="/js/core.util.js"></script>
<script>
    //获取token
    var token = CoreUtil.getData("access_token");
    //地址栏转义token中的#号
    var tokenQuery = token.replace("#", "%23");
    var tableIns1;
    var ajztDms;
    var table = layui.table;
    var form = layui.form;
    var layer = layui.layer;
    var $ = jQuery = layui.jquery;
    var laydate = layui.laydate;
    var tree = layui.tree;
    var la_startTime = null;
    var la_endTime = null;
    var zxwb_startTime = null;
    var zxwb_endTime = null;
    var ja_startTime = null;
    var ja_endTime = null;
    var selectMAjcx = layui.selectM;

    layui.config({
        base: '/'
    }).extend({
        eleTree: 'layui-ext/eleTree/eleTree',
        selectM: 'layui-ext/selectM/selectM'
    }).use(['table', 'laypage', 'layer', 'laydate', 'tree', 'eleTree'], function () {
        tableIns1 = table.render({
            elem: '#ajcx_table'
            , loading: false
            , page: true //开启分页
            // , parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
            //     return {
            //         "code": res.code, //解析接口状态
            //         "msg": res.msg, //解析提示文本
            //         "count": CoreUtil.isEmpty(res.data) ? 0 : res.data.total, //解析数据长度
            //         "data": CoreUtil.isEmpty(res.data) ? null : res.data.records //解析数据列表
            //     }
            // }
            // , contentType: 'application/json'
            // , headers: {"authorization": token}
            // ,where :whereParams
            // , url: '/thirdparty/dataVisualization/getInspectionData' //数据接口
            // , method: 'POST'
            // , parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
            //
            //     return {
            //         "code": res.status, //解析接口状态
            //         "msg": res.msg, //解析提示文本
            //         "count": CoreUtil.isEmpty(res.result) ? 0 : res.result.list.length, //解析数据长度
            //         "data": CoreUtil.isEmpty(res.result) ? null : res.result.list //解析数据列表
            //     }
            // }
            , cols: [
                [
                    // {type: 'checkbox', fixed: 'left'},
                    {field: 'jcajbh', title: '案件编号', width: 200},
                    {field: 'nsrmc', title: '纳税人名称', width: 200},
                    {field: 'nsrsbh', title: '纳税人识别号', width: 200},
                    {field: 'larq', title: '立案日期', width: 150},
                    {field: 'jarq', title: '结案日期', width: 150},
                    {field: 'jcswjg', title: '所在科室', width: 100},
                    {field: 'ajztmc', title: '案件状态', width: 100},
                    {field: 'zsztmc', title: '助手状态', width: 100},
                    {field: 'jcry', title: '检查人员', width: 200},
                    {field: 'jcdjrq', title: '检查登记日期', width: 150},
                    {field: 'jcjsrq', title: '检查结束日期', width: 150},
                    {field: 'slry', title: '审理人员', width: 200},
                    {field: 'sldjrq', title: '审理登记日期', width: 150},
                    {field: 'sljsrq', title: '审理结束日期', width: 150},
                    {field: 'zxry', title: '执行人员', width: 200},
                    {field: 'zxdjrq', title: '执行登记日期', width: 150},
                    {field: 'zxwbrq', title: '执行完毕日期', width: 150},
                    {field: 'cbse', title: '查补额', width: 150},
                    {field: 'rkse', title: '入库额', width: 150},
                    {field: 'ts', title: '案源数量', width: 150}
                ]
            ]
            // , toolbar: '#toolbar'
        });

        laydate.render({
            elem: '#lasjTime'
            , type: 'date'
            , range: '~'
            , done: function (value, date, endDate) {
                if (value != null && value != undefined && value != "") {
                    la_startTime = value.split("~")[0];
                    la_endTime = value.split("~")[1];
                } else {
                    la_startTime = null;
                    la_endTime = null;
                }

            }
        });


        laydate.render({
            elem: '#zxwbsjTime'
            , type: 'date'
            , range: '~'
            , done: function (value, date, endDate) {
                if (value != null && value != undefined && value != "") {
                    zxwb_startTime = value.split("~")[0];
                    zxwb_endTime = value.split("~")[1];
                } else {
                    zxwb_startTime = null;
                    zxwb_endTime = null;
                }

            }
        });



        laydate.render({
            elem: '#jasjTime'
            , type: 'date'
            , range: '~'
            , done: function (value, date, endDate) {
                if (value != null && value != undefined && value != "") {
                    ja_startTime = value.split("~")[0];
                    ja_endTime = value.split("~")[1];
                } else {
                    ja_startTime = null;
                    ja_endTime = null;
                }

            }
        });

        ajztDms =  selectMAjcx({
            //元素容器【必填】
            elem: '#ajztDm'
            //候选数据【必填】
            ,data:
                [{"id":"2","name":"在查"},{"id":"3","name":"在审"},{"id":"4","name":"在执行"},
                    {"id":"901","name":"办结"},{"id":"5","name":"结案"}
                ]
            //默认值
           ,tips: '请选择案件状态'
            //最多选中个数，默认5
            //值的分隔符
            ,delimiter: ','
            //候选项数据的键名
            ,field: {idName:'id',titleName:'name'}
        });

        form.on('submit(demo)',function(data){
            var formData = data.field;
            var ajztDms = formData.ajztDm;
            var whereParams = {
                "nsrsbh":$("#nsrsbh").val(),
                "nsrmc":$("#nsrmc").val(),
                "ajbh":$("#ajbh").val(),
                "lastartTime":la_startTime,
                "laendTime":la_endTime,
                "zxwbstartTime":zxwb_startTime,
                "zxwbendTime":zxwb_endTime,
                "jastartTime":ja_startTime,
                "jaendTime":ja_endTime,
                "ajztDm":ajztDms
            };
            tableIns1.reload({
                contentType: 'application/json'
                , headers: {"authorization": token}
                ,where :whereParams
                , url: '/attention/attentionMgr/ajcx' //数据接口
                , method: 'POST'
                , parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
                    return {
                        "code": res.code, //解析接口状态
                        "msg": res.msg, //解析提示文本
                        "count": CoreUtil.isEmpty(res.data) ? 0 : res.data.total, //解析数据长度
                        "data": CoreUtil.isEmpty(res.data) ? null : res.data.records //解析数据列表
                    }
                }, page: {
                    curr: 1 //重新从第 1 页开始
                }
            },false);
        })
    });

    //执行查询
    function search() {
        var whereParams = {
           "nsrsbh":$("#nsrsbh").val(),
           "nsrmc":$("#nsrmc").val(),
           "ajbh":$("#ajbh").val(),
           "lastartTime":la_startTime,
           "laendTime":la_endTime,
           "zxwbstartTime":zxwb_startTime,
           "zxwbendTime":zxwb_endTime,
           "jastartTime":ja_startTime,
           "jaendTime":ja_endTime,
           "ajztDms":ajztDms.values
        };
        tableIns1.reload({
            contentType: 'application/json'
            , headers: {"authorization": token}
            ,where :whereParams
            , url: '/attention/attentionMgr/ajcx' //数据接口
            , method: 'POST'
            , page: {
                curr: 1 //重新从第 1 页开始
            }
        },false);
    }
    function getCurrentDay(){
        var date = new Date();
        var year = date.getFullYear();
        var month = date.getMonth() + 1;
        var day = date.getDate();
        month = (month > 9) ? month : ("0" + month);
        day = (day < 10) ? ("0" + day) : day;
        var today = year + "-" + month + "-" + day;
        return today;
    }


</script>
</html>